package com.meatball.game.data

import com.alibaba.fastjson2.annotation.JSONField
import io.swagger.v3.oas.annotations.media.Schema

@Schema(description = "投票参数")
data class CastingVote (
        @Schema(description = "投票人ID", example = "512d63af0df24cd0be7e66a387da914c")
        val voter: String,
        @Schema(description = "候选人ID", example = "bb1df893f6b445ca81ca10e6749958e0")
        val candidate: String,
        @Schema(description = "是否是AI(true/false)", example = "false")
        @get:JSONField(name = "is_ai")
        @set:JSONField(name = "is_ai")
        var isAi: Int,
        @Schema(description = "时间戳", example = "1710317571990")
        val timestamp: Long = System.currentTimeMillis()
)

@Schema(description = "投票结果信息")
data class CastingVoteResult(
        @Schema(description = "头像", example = "https://meatball.org.cn:8000/images/2024/03/07/v2-6b9ade8a3dce476f0c56e9a52aa89d8b_r.jpg")
        val avatar: String,
        @Schema(description = "候选人ID", example = "bb1df893f6b445ca81ca10e6749958e0")
        val candidate: String,
        @Schema(description = "候选人名称", example = "李明")
        val name: String,
        @Schema(description = "投票结果(成功：success，失败：failed)", example = "success")
        val result: String,
        @Schema(description = "投票人ID", example = "512d63af0df24cd0be7e66a387da914c")
        val voter: String
)

/**
 * TODO 投票结果响应体
 *
 * @property code 状态码
 * @property msg 消息
 * @property results 结果
 */
data class CastingVoteResponse (
        val code: Int,
        val msg: String,
        val results: CastingVoteResult
)
